{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}/Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/replication.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}11 Apr 2017, 14:09:40

{com}. do "/var/folders/z2/qd98c80s3gz99pdxz_s_81h00000gn/T//SD76527.000000"
{txt}
{com}. * ==============================================================================
. *       Measuring Knowledge of Parties' Legislative Seat Shares
. *       Lee, Haime & Stevenson 
. *       Replication Do File: Tables and Figures
. * ==============================================================================
. set scheme sol /* ado file available at: https://dl.dropbox.com/u/3011470/scheme_sol.zip */
{txt}
{com}. set more off
{txt}
{com}. 
. ********************************************************************************
. *****                                    *******************************************************
. *****   UNITED KINGDOM   *******************************************************
. *****                                    *******************************************************
. ********************************************************************************
. 
. use "datasetUK.dta", clear
{txt}
{com}. 
. 
. * =====================
. * Table 1 UK
. * ===================== 
. 
.         /** [Row 1] Gave a 100% to one party (numzeros==11) **/ 
.                 tab numzeros

   {txt}numzeros {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}        256       18.35       18.35
{txt}          1 {c |}{res}        113        8.10       26.45
{txt}          2 {c |}{res}         98        7.03       33.48
{txt}          3 {c |}{res}        107        7.67       41.15
{txt}          4 {c |}{res}        114        8.17       49.32
{txt}          5 {c |}{res}        128        9.18       58.49
{txt}          6 {c |}{res}        148       10.61       69.10
{txt}          7 {c |}{res}        162       11.61       80.72
{txt}          8 {c |}{res}        116        8.32       89.03
{txt}          9 {c |}{res}         49        3.51       92.54
{txt}         10 {c |}{res}         38        2.72       95.27
{txt}         11 {c |}{res}         66        4.73      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      1,395      100.00
{txt}
{com}.                         
.         /** [Row 2] Answered the question in under 10s **/
.                 gen under10s=(time<=10) if time!=.
{txt}(1 missing value generated)

{com}.                 tab under10s

   {txt}under10s {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      1,291       92.61       92.61
{txt}          1 {c |}{res}        103        7.39      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      1,394      100.00
{txt}
{com}.                 
.         /** [Row 3] Answered the question in under 20s **/
.                 gen under20s=(time<=20) if time!=.
{txt}(1 missing value generated)

{com}.                 tab under20s

   {txt}under20s {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      1,222       87.66       87.66
{txt}          1 {c |}{res}        172       12.34      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      1,394      100.00
{txt}
{com}. 
.         /** [Rows 4] A or B **/
.                 gen aorb = 0
{txt}
{com}.                 replace aorb = 1 if numzeros==11 | under10s==1
{txt}(110 real changes made)

{com}.                 tab aorb

       {txt}aorb {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      1,285       92.11       92.11
{txt}          1 {c |}{res}        110        7.89      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      1,395      100.00
{txt}
{com}.                         
.         /** [Rows 5] A or C **/
.                 gen aorc = 0
{txt}
{com}.                 replace aorc = 1 if numzeros==11 | under20s==1
{txt}(174 real changes made)

{com}.                 tab aorc

       {txt}aorc {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      1,221       87.53       87.53
{txt}          1 {c |}{res}        174       12.47      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      1,395      100.00
{txt}
{com}.                                         
. * =====================
. * Table 2 UK
. * =====================
.         
.         /** [Row 1] Abandoned **/       
.         preserve
{txt}
{com}.                 * load dataset with all individuals who started the survey
.                 use "hazardUK.dta", clear
{txt}
{com}.                         gen group=.     
{txt}(1665 missing values generated)

{com}.                         replace group = 1 if seatsfixed_t !=.
{txt}(350 real changes made)

{com}.                         replace group = 2 if seatsrandom_t !=.
{txt}(358 real changes made)

{com}.                         replace group = 3 if percentfixed_t !=.
{txt}(363 real changes made)

{com}.                         replace group = 4 if percentrandom_t !=.
{txt}(359 real changes made)

{com}.                         label def group 1 "seats fixed" 2 "seats random" 3 "percent fixed" 4 "percent random" 
{txt}
{com}.                         label val group group
{txt}
{com}.                 * denominators
.                         tabstat seatsfixed_tc seatsrandom_tc percentfixed_tc percentrandom_tc , stats(n)

{txt}   stats {...}
{c |}{...}
  sea~d_tc  sea~m_tc  per~d_tc  per~m_tc
{hline 9}{c +}{hline 40}
{ralign 8:N} {...}
{c |}{...}
 {res}      350       358       363       359
{txt}{hline 9}{c BT}{hline 40}

{com}.                         gen reached = 1 if seatsfixed_tc!=.| seatsrandom_tc!=.| percentfixed_tc!=.| percentrandom_tc!=.
{txt}(235 missing values generated)

{com}.                 * numerators: count the abandoned, by looking at missing answers for a set of questions coming after the seats question
.                         gen dropout=1 if reached==1
{txt}(235 missing values generated)

{com}.                                 set more off
{txt}
{com}.                                 foreach i of varlist taxspending_set1-scottishindep_set5 {c -(}
{txt}  2{com}.                                         replace dropout=0 if `i'!=.&dropout==1
{txt}  3{com}.                                 {c )-}
{txt}(1417 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)

{com}.                 * abandoned (count and percentage)
.                         tab dropout group, col
{txt}
{c TLC}{hline 19}{c TRC}
{c |} Key{col 21}{c |}
{c LT}{hline 19}{c RT}
{c |}{space 5}{it:frequency}{col 21}{c |}
{c |}{space 1}{it:column percentage}{col 21}{c |}
{c BLC}{hline 19}{c BRC}

           {c |}                    group
   dropout {c |} seats fix  seats ran  percent f  percent r {c |}     Total
{hline 11}{c +}{hline 44}{c +}{hline 10}
         0 {c |}{res}       348        355        359        355 {txt}{c |}{res}     1,417 
           {txt}{c |}{res}     99.43      99.16      98.90      98.89 {txt}{c |}{res}     99.09 
{txt}{hline 11}{c +}{hline 44}{c +}{hline 10}
         1 {c |}{res}         2          3          4          4 {txt}{c |}{res}        13 
           {txt}{c |}{res}      0.57       0.84       1.10       1.11 {txt}{c |}{res}      0.91 
{txt}{hline 11}{c +}{hline 44}{c +}{hline 10}
     Total {c |}{res}       350        358        363        359 {txt}{c |}{res}     1,430 
           {txt}{c |}{res}    100.00     100.00     100.00     100.00 {txt}{c |}{res}    100.00 

{txt}
{com}.         restore
{txt}
{com}.         
.         /** [Row 2] Gave a 100% to one party (numzeros==11) ***/
.                 tab numzeros group 

           {txt}{c |}                    group
  numzeros {c |} seats ran  seats fix  percent r  percent f {c |}     Total
{hline 11}{c +}{hline 44}{c +}{hline 10}
         0 {c |}{res}        41         48         78         88 {txt}{c |}{res}       255 
{txt}         1 {c |}{res}        20         20         41         32 {txt}{c |}{res}       113 
{txt}         2 {c |}{res}        16         16         34         32 {txt}{c |}{res}        98 
{txt}         3 {c |}{res}        28         33         21         25 {txt}{c |}{res}       107 
{txt}         4 {c |}{res}        33         32         21         28 {txt}{c |}{res}       114 
{txt}         5 {c |}{res}        40         34         30         24 {txt}{c |}{res}       128 
{txt}         6 {c |}{res}        55         44         29         20 {txt}{c |}{res}       148 
{txt}         7 {c |}{res}        51         52         29         30 {txt}{c |}{res}       162 
{txt}         8 {c |}{res}        32         29         23         32 {txt}{c |}{res}       116 
{txt}         9 {c |}{res}        13         14         11         11 {txt}{c |}{res}        49 
{txt}        10 {c |}{res}        11          8          9         10 {txt}{c |}{res}        38 
{txt}        11 {c |}{res}        12         12         24         18 {txt}{c |}{res}        66 
{txt}{hline 11}{c +}{hline 44}{c +}{hline 10}
     Total {c |}{res}       352        342        350        350 {txt}{c |}{res}     1,394 

{txt}
{com}.         
.         /** [Row 3] Under 10s (under10s==1) **/
.                 tab under10s group, col
{txt}
{c TLC}{hline 19}{c TRC}
{c |} Key{col 21}{c |}
{c LT}{hline 19}{c RT}
{c |}{space 5}{it:frequency}{col 21}{c |}
{c |}{space 1}{it:column percentage}{col 21}{c |}
{c BLC}{hline 19}{c BRC}

           {c |}                    group
  under10s {c |} seats ran  seats fix  percent r  percent f {c |}     Total
{hline 11}{c +}{hline 44}{c +}{hline 10}
         0 {c |}{res}       333        327        318        313 {txt}{c |}{res}     1,291 
           {txt}{c |}{res}     94.60      95.61      90.86      89.43 {txt}{c |}{res}     92.61 
{txt}{hline 11}{c +}{hline 44}{c +}{hline 10}
         1 {c |}{res}        19         15         32         37 {txt}{c |}{res}       103 
           {txt}{c |}{res}      5.40       4.39       9.14      10.57 {txt}{c |}{res}      7.39 
{txt}{hline 11}{c +}{hline 44}{c +}{hline 10}
     Total {c |}{res}       352        342        350        350 {txt}{c |}{res}     1,394 
           {txt}{c |}{res}    100.00     100.00     100.00     100.00 {txt}{c |}{res}    100.00 

{txt}
{com}. 
. * =====================
. * Figure 3 
. * ===================== 
.           
.         /** Conservative **/ 
.                 histogram sizepercent_lab, xline(33, lpattern(solid)) xline(41, lpattern(dash)) ///
>                 freq by(group, title("Conservative") note("")) xtitle("Percent of Seats Assigned", size(small))  name(con, replace)
{res}{txt}
{com}.         
.         /** Labour **/ 
.                 histogram sizepercent_cons, xline(34, lpattern(solid)) xline(43, lpattern(dash)) ///
>                 freq by(group, title("Labour") note("")) xtitle("Percent of Seats Assigned", size(small)) ytitle ("") name(lab, replace)
{res}{txt}
{com}.           
.                 graph combine con lab, xsize(8) ysize(3) scale(1.4)
{res}{txt}
{com}.                 graph export "figure3.pdf", replace
{txt}(file /Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/figure3.pdf written in PDF format)

{com}.                 
. * =====================
. * Footnote 13: UK 
. * ===================== 
.         
.         /** calculate mean absolute error **/
.           
.           capture drop abserrorvote_con
{txt}
{com}.           gen abserrorvote_con=.
{txt}(1395 missing values generated)

{com}.           replace abserrorvote_con=abs(sizepercent_cons-34)
{txt}(1393 real changes made)

{com}.           tabstat abserrorvote_con, by(group) stats(mean median n)

{txt}Summary for variables: abserrorvote_con
{col 6}by categories of: group 

{ralign 14:group} {...}
{c |}      mean       p50         N
{hline 15}{c +}{hline 30}
{ralign 14:seats random} {...}
{c |}{...}
 {res} 12.60511        11       352
{txt}{ralign 14:seats fixed} {...}
{c |}{...}
 {res} 12.52632        11       342
{txt}{ralign 14:percent random} {...}
{c |}{...}
 {res} 11.12857         6       350
{txt}{ralign 14:percent fixed} {...}
{c |}{...}
 {res} 10.70487         6       349
{txt}{hline 15}{c +}{hline 30}
{ralign 14:Total} {...}
{c |}{...}
 {res} 11.73869         9      1393
{txt}{hline 15}{c BT}{hline 30}

{com}.           
.           capture drop abserrorseat_con
{txt}
{com}.           gen abserrorseat_con=.
{txt}(1395 missing values generated)

{com}.           replace abserrorseat_con=abs(sizepercent_cons-43)       
{txt}(1393 real changes made)

{com}.           tabstat abserrorseat_con, by(group) stats(mean median n)

{txt}Summary for variables: abserrorseat_con
{col 6}by categories of: group 

{ralign 14:group} {...}
{c |}      mean       p50         N
{hline 15}{c +}{hline 30}
{ralign 14:seats random} {...}
{c |}{...}
 {res} 11.93466       5.5       352
{txt}{ralign 14:seats fixed} {...}
{c |}{...}
 {res} 11.20468         6       342
{txt}{ralign 14:percent random} {...}
{c |}{...}
 {res} 15.41429        11       350
{txt}{ralign 14:percent fixed} {...}
{c |}{...}
 {res} 13.74499        10       349
{txt}{hline 15}{c +}{hline 30}
{ralign 14:Total} {...}
{c |}{...}
 {res} 13.08327         8      1393
{txt}{hline 15}{c BT}{hline 30}

{com}.           
.           capture drop abserrorvote_lab
{txt}
{com}.           gen abserrorvote_lab=.
{txt}(1395 missing values generated)

{com}.           replace abserrorvote_lab=abs(sizepercent_lab-33)
{txt}(1394 real changes made)

{com}.           tabstat abserrorvote_lab, by(group) stats(mean median n)

{txt}Summary for variables: abserrorvote_lab
{col 6}by categories of: group 

{ralign 14:group} {...}
{c |}      mean       p50         N
{hline 15}{c +}{hline 30}
{ralign 14:seats random} {...}
{c |}{...}
 {res} 11.76989        10       352
{txt}{ralign 14:seats fixed} {...}
{c |}{...}
 {res} 11.66667        10       342
{txt}{ralign 14:percent random} {...}
{c |}{...}
 {res}   11.328         7       350
{txt}{ralign 14:percent fixed} {...}
{c |}{...}
 {res} 9.432857         5       350
{txt}{hline 15}{c +}{hline 30}
{ralign 14:Total} {...}
{c |}{...}
 {res} 11.04684         7      1394
{txt}{hline 15}{c BT}{hline 30}

{com}.           
.           capture drop abserrorseat_con
{txt}
{com}.           gen abserrorseat_con=.
{txt}(1395 missing values generated)

{com}.           replace abserrorseat_con=abs(sizepercent_lab-41)        
{txt}(1394 real changes made)

{com}.           tabstat abserrorseat_con, by(group) stats(mean median n)

{txt}Summary for variables: abserrorseat_con
{col 6}by categories of: group 

{ralign 14:group} {...}
{c |}      mean       p50         N
{hline 15}{c +}{hline 30}
{ralign 14:seats random} {...}
{c |}{...}
 {res} 11.25852         6       352
{txt}{ralign 14:seats fixed} {...}
{c |}{...}
 {res} 11.25731         6       342
{txt}{ralign 14:percent random} {...}
{c |}{...}
 {res} 14.67086        11       350
{txt}{ralign 14:percent fixed} {...}
{c |}{...}
 {res} 12.69286         9       350
{txt}{hline 15}{c +}{hline 30}
{ralign 14:Total} {...}
{c |}{...}
 {res} 12.47511         8      1394
{txt}{hline 15}{c BT}{hline 30}

{com}. 
. * =====================
. * Figure 4 UK 
. * ===================== 
. 
.         ssc install triplot
{txt}checking {hilite:triplot} consistency and verifying not already installed...
all files already exist and are up to date.

{com}. 
.         gen cons=sizepercent_cons
{txt}(2 missing values generated)

{com}.         gen lab=sizepercent_lab
{txt}(1 missing value generated)

{com}.         egen other1=rowtotal(sizepercent_*)
{txt}
{com}.         gen other=other1-(cons+lab)
{txt}(2 missing values generated)

{com}.         replace other=100 if other>100
{txt}(4 real changes made)

{com}.         
.         local name1 "Seat, Numbers"
{txt}
{com}.         local name2 "Seat, Shares"
{txt}
{com}. 
.         foreach jj of numlist 1 2 {c -(}
{txt}  2{com}.         triplot cons lab  other if group==`jj', y mcolor(gray) ltext(Cons) rtext(Lab) btext(Other) ///
>                  max(100) title("`name`jj''", size(medsmall)) name(gg`jj', replace) nodraw
{txt}  3{com}.                 {c )-}
{txt}
{com}. 
.         graph combine gg1 gg2, rows(1) imargin(tiny) xsize(10) ysize(4) scale(1.6)      
{res}{txt}
{com}.         graph export "figure4.pdf", replace
{txt}(file /Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/figure4.pdf written in PDF format)

{com}.                          
. * =====================
. * APPENDIX Figure C: UK 
. * ===================== 
. 
.         graph box clicks, over(numzeros) ytitle("Number of Clicks") ///
>         b1title("Number of Zeros Reported")     title("United Kingdom") name(figureC_uk, replace)
{res}{txt}
{com}.         
.         tabstat clicks, stat(med sd)

{txt}{ralign 12:variable} {...}
{c |}       p50        sd
{hline 13}{c +}{hline 20}
{ralign 12:clicks} {...}
{c |}{...}
 {res}       13  9.918959
{txt}{hline 13}{c BT}{hline 20}

{com}.         
. * =====================
. * APPENDIX Figure D: UK 
. * =====================         
. 
.         replace changes=abs(changes)
{txt}(116 real changes made)

{com}.         histogram changes, by(group, title("United Kingdom") note("")) freq xtitle("Number of Changes") name(figureD_uk, replace)       
{res}{txt}
{com}. 
. * =====================
. * APPENDIX Figure E: UK
. * ===================== 
. 
.         histogram time, by(group, title("United Kingdom") note("")) freq xtitle("Seconds to Complete Question") name(figureE_uk, replace)
{res}{txt}
{com}. 
. * =====================
. * APPENDIX Figure F1 
. * =====================
.         
.         foreach i in dup libdem sdlp snp pc ukip green sf {c -(}
{txt}  2{com}.         set more off
{txt}  3{com}.         local ndup "DUP"
{txt}  4{com}.         local nlibdem "Liberal Democrats"
{txt}  5{com}.         local nsdlp "SDLP"
{txt}  6{com}.         local nsnp "SNP"
{txt}  7{com}.         local npc "Plaid Cymru"
{txt}  8{com}.         local nukip "UKIP"
{txt}  9{com}.         local ngreen "Greens"
{txt} 10{com}.         local nsf "Sinn Fein"
{txt} 11{com}.         qui sum sizepercent_`i'
{txt} 12{com}.                 local m = r(mean)
{txt} 13{com}.         qui sum pollpc_`i'
{txt} 14{com}.                 local pollm = r(mean)
{txt} 15{com}.         histogram sizepercent_`i', xline(`m', lpattern(solid)) xlabel(0(50)100) ///
>                 xline(`pollm', lpattern(tight_dot) lwidth(medthick)) freq ///
>                 by(group, title("`n`i''", size(medium)) note("")) ytitle("") ///
>                 xtitle("Percent of Seats Assigned", size(small)) name(`i', replace) nodraw
{txt} 16{com}.         {c )-}
{txt}
{com}. 
.         graph combine libdem green snp ukip dup sdlp pc sf, ///
>                 xsize(4.5) ysize(6.5) imargin(small) rows(4) note("") scale(0.9)        
{res}{txt}
{com}.         graph export "figureF1.pdf", replace
{txt}(file /Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/figureF1.pdf written in PDF format)

{com}.         
. 
.         
. ********************************************************************************
. *****                     **************************************************************
. *****   DENMARK   **************************************************************
. *****                     **************************************************************
. ********************************************************************************
. 
. use "datasetDK.dta", clear
{txt}
{com}. 
. * =====================
. * Table 1 DK
. * ===================== 
.         
.         /** [Row 1] Gave a 100% to one party (numzeros==9) **/  
.                 tab numzeros

   {txt}numzeros {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}        412       29.03       29.03
{txt}          1 {c |}{res}        575       40.52       69.56
{txt}          2 {c |}{res}        183       12.90       82.45
{txt}          3 {c |}{res}         75        5.29       87.74
{txt}          4 {c |}{res}         33        2.33       90.06
{txt}          5 {c |}{res}         25        1.76       91.83
{txt}          6 {c |}{res}         24        1.69       93.52
{txt}          7 {c |}{res}         22        1.55       95.07
{txt}          8 {c |}{res}         27        1.90       96.97
{txt}          9 {c |}{res}         43        3.03      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      1,419      100.00
{txt}
{com}.                 
.         /** [Row 2] Answered the question in under 10s **/      
.                 tab under10s

   {txt}under10s {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      1,338       94.36       94.36
{txt}          1 {c |}{res}         80        5.64      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      1,418      100.00
{txt}
{com}. 
.         /** [Row 3] Answered the question in under 20s **/
.                 gen under20s=(time<=20) if time!=.
{txt}(1 missing value generated)

{com}.                 tab under20s

   {txt}under20s {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      1,295       91.33       91.33
{txt}          1 {c |}{res}        123        8.67      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      1,418      100.00
{txt}
{com}.         
.         /** [Rows 4] A or B **/
.                 gen aorb = 0
{txt}
{com}.                 replace aorb = 1 if numzeros==9 | under10s==1
{txt}(85 real changes made)

{com}.                 tab aorb

       {txt}aorb {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      1,334       94.01       94.01
{txt}          1 {c |}{res}         85        5.99      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      1,419      100.00
{txt}
{com}.                         
.         /** [Rows 5] A or C **/
.                 gen aorc = 0
{txt}
{com}.                 replace aorc = 1 if numzeros==9 | under20s==1
{txt}(126 real changes made)

{com}.                 tab aorc

       {txt}aorc {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      1,293       91.12       91.12
{txt}          1 {c |}{res}        126        8.88      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      1,419      100.00
{txt}
{com}. 
. * ==================
. * Table 2 DK
. * ==================    
.                 
.         /** [Row 1] Abandoned **/       
.         preserve
{txt}
{com}.                 * load dataset with all individuals who started the survey
.                 use "hazardDK.dta", clear
{txt}
{com}.                 quietly destring pid-q140_4, replace
{txt}
{com}.                         gen group=.     
{txt}(1917 missing values generated)

{com}.                         replace group = 1 if q54_1 !=.
{txt}(365 real changes made)

{com}.                         replace group = 2 if q52_1 !=.
{txt}(360 real changes made)

{com}.                         replace group = 3 if q58_1 !=.
{txt}(371 real changes made)

{com}.                         replace group = 4 if q56_1 !=.
{txt}(374 real changes made)

{com}.                         label def group 1 "seats fixed" 2 "seats random" 3 "percent fixed" 4 "percent random" 
{txt}
{com}.                         label val group group
{txt}
{com}.                 * denominators
.                         tabstat q54_4 q52_4 q58_4 q56_4, stats(n)

{txt}   stats {...}
{c |}{...}
     q54_4     q52_4     q58_4     q56_4
{hline 9}{c +}{hline 40}
{ralign 8:N} {...}
{c |}{...}
 {res}      365       360       371       374
{txt}{hline 9}{c BT}{hline 40}

{com}.                         gen reached = 1 if q54_4!=.| q52_4!=.| q58_4!=.| q56_4!=.
{txt}(447 missing values generated)

{com}.                 * numerators: count the abandoned, by looking at missing answers for a set of questions coming after the seats question
.                         gen dropout=1 if reached==1
{txt}(447 missing values generated)

{com}.                                 set more off
{txt}
{com}.                                 foreach i of varlist q105-q107 q109-q111 q113-q115 q117-q119 q121-q123 q125-q127 {c -(}
{txt}  2{com}.                                         replace dropout=0 if `i'!=.&dropout==1
{txt}  3{com}.                                 {c )-}
{txt}(1444 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)

{com}.                 * abandoned (count and percentage)
.                         tab dropout group, col 
{txt}
{c TLC}{hline 19}{c TRC}
{c |} Key{col 21}{c |}
{c LT}{hline 19}{c RT}
{c |}{space 5}{it:frequency}{col 21}{c |}
{c |}{space 1}{it:column percentage}{col 21}{c |}
{c BLC}{hline 19}{c BRC}

           {c |}                    group
   dropout {c |} seats fix  seats ran  percent f  percent r {c |}     Total
{hline 11}{c +}{hline 44}{c +}{hline 10}
         0 {c |}{res}       358        355        366        365 {txt}{c |}{res}     1,444 
           {txt}{c |}{res}     98.08      98.61      98.65      97.59 {txt}{c |}{res}     98.23 
{txt}{hline 11}{c +}{hline 44}{c +}{hline 10}
         1 {c |}{res}         7          5          5          9 {txt}{c |}{res}        26 
           {txt}{c |}{res}      1.92       1.39       1.35       2.41 {txt}{c |}{res}      1.77 
{txt}{hline 11}{c +}{hline 44}{c +}{hline 10}
     Total {c |}{res}       365        360        371        374 {txt}{c |}{res}     1,470 
           {txt}{c |}{res}    100.00     100.00     100.00     100.00 {txt}{c |}{res}    100.00 

{txt}
{com}.         restore
{txt}
{com}. 
.         /** [Row 2] Gave a 100% to one party (numzeros==9) **/  
.                 tab numzeros group

           {txt}{c |}                    group
  numzeros {c |} seats ran  seats fix  percent r  percent f {c |}     Total
{hline 11}{c +}{hline 44}{c +}{hline 10}
         0 {c |}{res}        90        112        107        102 {txt}{c |}{res}       411 
{txt}         1 {c |}{res}       158        158        136        123 {txt}{c |}{res}       575 
{txt}         2 {c |}{res}        36         48         47         52 {txt}{c |}{res}       183 
{txt}         3 {c |}{res}        26          8         13         28 {txt}{c |}{res}        75 
{txt}         4 {c |}{res}         7          5         13          8 {txt}{c |}{res}        33 
{txt}         5 {c |}{res}         7          1          9          8 {txt}{c |}{res}        25 
{txt}         6 {c |}{res}         4          3          7         10 {txt}{c |}{res}        24 
{txt}         7 {c |}{res}         5          4          6          7 {txt}{c |}{res}        22 
{txt}         8 {c |}{res}         7          4          6         10 {txt}{c |}{res}        27 
{txt}         9 {c |}{res}        11         10         10         12 {txt}{c |}{res}        43 
{txt}{hline 11}{c +}{hline 44}{c +}{hline 10}
     Total {c |}{res}       351        353        354        360 {txt}{c |}{res}     1,418 

{txt}
{com}. 
.         /** [Row 3] Under 10s **/
.                 tab under10s group, col
{txt}
{c TLC}{hline 19}{c TRC}
{c |} Key{col 21}{c |}
{c LT}{hline 19}{c RT}
{c |}{space 5}{it:frequency}{col 21}{c |}
{c |}{space 1}{it:column percentage}{col 21}{c |}
{c BLC}{hline 19}{c BRC}

           {c |}                    group
  under10s {c |} seats ran  seats fix  percent r  percent f {c |}     Total
{hline 11}{c +}{hline 44}{c +}{hline 10}
         0 {c |}{res}       333        340        331        334 {txt}{c |}{res}     1,338 
           {txt}{c |}{res}     94.87      96.32      93.50      92.78 {txt}{c |}{res}     94.36 
{txt}{hline 11}{c +}{hline 44}{c +}{hline 10}
         1 {c |}{res}        18         13         23         26 {txt}{c |}{res}        80 
           {txt}{c |}{res}      5.13       3.68       6.50       7.22 {txt}{c |}{res}      5.64 
{txt}{hline 11}{c +}{hline 44}{c +}{hline 10}
     Total {c |}{res}       351        353        354        360 {txt}{c |}{res}     1,418 
           {txt}{c |}{res}    100.00     100.00     100.00     100.00 {txt}{c |}{res}    100.00 

{txt}
{com}.                 
. * ==================
. * Figure 5 
. * ==================    
. 
.         /** Social Democrats **/
.                 histogram sizepercent_socdem, xline(25.07, lpattern(solid)) freq ///
>                 by(group, title("Social Democrats") note("")) xtitle("Percent of Seats Assigned", size(small)) name(sd, replace)
{res}{txt}
{com}.           
.         /** Venstre **/
.                 histogram sizepercent_ven, xline(20.71, lpattern(solid)) freq /// 
>                 by(group, title("Venstre") note("")) xtitle("Percent of Seats Assigned", size(small)) ytitle ("") name(ven, replace)
{res}{txt}
{com}. 
.                 graph combine sd ven, xsize(8) ysize(3) scale(1.4)
{res}{txt}
{com}.                 graph export "figure5.pdf", replace
{txt}(file /Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/figure5.pdf written in PDF format)

{com}.                 
. * =====================
. * APPENDIX Figure C: DK 
. * ===================== 
. 
.         graph box clicks if clicks<100, over(numzeros) ytitle("Number of Clicks") ///
>         b1title("Number of Zeros Reported") title("Denmark") name(figureC_dk, replace)
{res}{txt}
{com}.         
.         tabstat clicks, stat(med sd)

{txt}{ralign 12:variable} {...}
{c |}       p50        sd
{hline 13}{c +}{hline 20}
{ralign 12:clicks} {...}
{c |}{...}
 {res}       15  11.12502
{txt}{hline 13}{c BT}{hline 20}

{com}. 
.         graph combine figureC_uk figureC_dk, xsize(4) ysize(1.5) scale(1.3)
{res}{txt}
{com}.         graph export "figureC.pdf", replace
{txt}(file /Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/figureC.pdf written in PDF format)

{com}.         
. * =====================
. * APPENDIX Figure D: DK 
. * =====================         
. 
.         replace changes=abs(changes) 
{txt}(0 real changes made)

{com}.                 
.         /** limit x-axis: make it comparable to uk graph **/
.         histogram changes if changes <90, by(group, title("Denmark") note("")) ///
>                 xlabel(0(20)80) freq xtitle("Number of Changes") name(figureD_dk, replace)
{res}{txt}
{com}. 
.         graph combine figureD_uk figureD_dk, xsize(4) ysize(1.5) scale(1.5)
{res}{txt}
{com}.         graph export "figureD.pdf", replace
{txt}(file /Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/figureD.pdf written in PDF format)

{com}.         
. * =====================
. * APPENDIX Figure E: DK
. * ===================== 
.         
.         /** limit x-axis **/
.         histogram time if time<3000, by(group, title("Denmark") note(""))  freq xtitle("Seconds to Complete Question") name(figureE_dk, replace)
{res}{txt}
{com}.         
.         graph combine figureE_uk figureE_dk, xsize(4) ysize(1.5) scale(1.5)
{res}{txt}
{com}.         graph export "figureE.pdf", replace
{txt}(file /Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/figureE.pdf written in PDF format)

{com}.         
. * =====================
. * APPENDIX Figure F2
. * ===================== 
.                         
.         foreach i in socdem ven radven konfol socfol liball kridem danfol enh alt {c -(}
{txt}  2{com}.         set more off
{txt}  3{com}.         local nsocdem "Social Democrats"
{txt}  4{com}.         local nven "Venstre"
{txt}  5{com}.         local nradven "Radical Venstre"
{txt}  6{com}.         local nkonfol "Conservative People's Party"
{txt}  7{com}.         local nsocfol "Social People's Party"
{txt}  8{com}.         local nliball "Liberal Alliance"
{txt}  9{com}.         local nkridem "Christian Democrats"
{txt} 10{com}.         local ndanfol "Danish People's Party"
{txt} 11{com}.         local nenh "Red-Green alliance"
{txt} 12{com}.         local nalt "Alternative"
{txt} 13{com}.         qui sum sizepercent_`i'
{txt} 14{com}.                 local m = r(mean)
{txt} 15{com}.         histogram sizepercent_`i', xline(`m', lpattern(solid)) xlabel(0(50)100) freq ///
>                 by(group, title("`n`i''", size(medium)) note("")) ytitle("") ///
>                 xtitle("Percent of Seats Assigned", size(small)) name(`i', replace) nodraw
{txt} 16{com}.         {c )-}
{txt}
{com}. 
.         graph combine radven liball danfol enh socfol konfol alt kridem, ///
>                 xsize(4.5) ysize(6.5) imargin(small) rows(4) note("") scale(0.9)        
{res}{txt}
{com}.         graph export "figureF2.pdf", replace
{txt}(file /Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/figureF2.pdf written in PDF format)

{com}. 
.         
.         
.         
. *\END
. 
{txt}end of do-file

{com}. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}/Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/replication.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}11 Apr 2017, 14:12:14
{txt}{.-}
{smcl}
{txt}{sf}{ul off}